
(function($){
	$.fn.Zoomer=function(b){
		var c=$.extend({
		speedView:10,
		speedRemove:10,
		altAnim:false,
		speedTitle:10,
		debug:false
	},b);
	var d=$.extend(c,b);
	function e(s){
		if(typeof console!="undefined" && typeof console.debug!="undefined")
		{
		console.log(s)
		}else{alert(s)}}
		if(d.speedView==undefined||d.speedRemove==undefined||d.altAnim==undefined||d.speedTitle==undefined)
		{
			e('speedView: '+d.speedView);
			e('speedRemove: '+d.speedRemove);
			e('altAnim: '+d.altAnim);
			e('speedTitle: '+d.speedTitle);
			return false
		}
		if(d.debug==undefined){
			e('speedView: '+d.speedView);
			e('speedRemove: '+d.speedRemove);
			e('altAnim: '+d.altAnim);
			e('speedTitle: '+d.speedTitle);
			return false
		}
		if(typeof d.speedView!="undefined"||typeof d.speedRemove!="undefined"||typeof d.altAnim!="undefined"||typeof d.speedTitle!="undefined")
		{
			if(d.debug==true){
				e('speedView: '+d.speedView);
				e('speedRemove: '+d.speedRemove);
				e('altAnim: '+d.altAnim);
				e('speedTitle: '+d.speedTitle)
				}
			$(this).hover(function(){
				$(this).css({'z-index':'10'});
				//$(this).find('img').addClass("hover").stop().animate({
				//	marginTop:'-90px',marginLeft:'-90px',top:'50%',left:'50%',width:'190px',height:'190px',padding:'0px'},d.speedView);
                                //  $(this).find('img').addClass("hover");
				if(d.altAnim==true)
                                {
					var a=$(this).find("img").attr("alt");
                                        var enlace=$(this).find("a").attr("href");
                                        var enlaceroto = $(this).find("a").attr("class");
					if(a.length!=0)
                                        {
                                                var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
                                                var is_opera = navigator.userAgent.toLowerCase().indexOf('opera') > -1;
                                                var is_safari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
                                                var is_iis = navigator.userAgent.toLowerCase().indexOf('msie') > -1;
                                                $(this).prepend('<a href="'+enlace+'" id="ventana"><img id="meta" class="hover" src="resources/img/marco.png" /></a>');
                                                if(enlaceroto!="pointbreak")
                                                {
                                                    if(is_iis)
                                                    {
                                                       $("#ventana").fancybox2({"width": 920,"height": 570,"autoScale": false,"transitionIn": "elastic","transitionOut": "none","type": "iframe"});
                                                    }
                                                    else
                                                    {
                                                       $("#ventana").fancybox2({"width": 890,"height": 570,"autoScale": false,"transitionIn": "elastic","transitionOut": "none","type": "iframe"});
                                                    }
                                                }
						$(this).prepend('<span class="title">'+a+'</span>');
                                                $('#meta').animate({marginLeft:'-8px',marginTop:'0px'},1).css({'z-index':'9','position':'absolute','float':'left'});
                                                //$('#meta').css({'z-index':'9','position':'absolute','float':'left'});
                                                if(is_chrome || is_opera || is_safari)
                                                 {
                                                     $('.title').animate({marginLeft:'-5px',marginTop:'160px'},d.speedTitle).css({'z-index':'10','position':'absolute','float':'left'})
                                                 }
                                                 else //if(is_iis)
                                                 {
                                                     $('.title').animate({marginLeft:'-90px',marginTop:'160px'},d.speedTitle).css({'z-index':'10','position':'absolute','float':'left'})
                                                 }
                                        }


                                }
			},function(){$(this).css({'z-index':'0'});
			$(this).find('img').removeClass("hover").stop().animate({marginTop:'0',marginLeft:'0',top:'0',left:'0',width:'170px',height:'170px',padding:'0px'},d.speedRemove);
			$(this).find('.title').remove();
                        $(this).find('#meta').remove();
                        $(this).find('#ventana').remove();
                    })
                }
		}
	})(jQuery);